<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../../css/common.css" media="all">

	</head>

	<body>

		<div class="layui-fluid">
			<div class="layui-row" id="view">
				<form class="layui-form" lay-filter="test_detail">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">会员名称</label>
									<div class="layui-input-inline">
										<input type="text" name="member_name" readonly autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">会员编号</label>
									<div class="layui-input-inline">
                    <input type="text" name="change_memberid" readonly autocomplete="off" class="layui-input">
                  </div>
								</div>
							</div>
							<div class="layui-form-item">
								<div class="layui-block">
									<label class="layui-form-label">手机号</label>
									<div class="layui-input-block">
										<input type="text" name="mobile" readonly autocomplete="off" class="layui-input">
									</div>
								</div> 
							</div>

              <div class="layui-form-item">
								<div class="layui-block">
									<label class="layui-form-label">身份</label>
									<div class="layui-input-block">
										<select name="change_identity" lay-verify="required" >
                      <option value="">请选择</option>
                      <option value="leader_id">团长</option>
                      <option value="team_id">团队长</option>
                      <option value="copartner_id">合伙人</option>
                    </select>
									</div>
								</div> 
							</div>
						</div>
					</div> 
					<div class="layui-form-item layui-layout-admin">
						<div class="layui-input-block">
							<div class="layui-footer" style="left: 0;"> 
								<button class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script src="../../../../layuiadmin/layui/layui.js"></script>
		<script src="../../../../js/jquery.min.js"></script>
		<script src="../../../../js/common.js"></script>
		<script>
			var _data = {
				member_name: getParam('member_name'),
				change_memberid: getParam('change_memberid'),
				mobile: getParam('mobile'),
			}

      console.log(_data);
      $('input[name="member_name"]').val(_data.member_name)
      $('input[name="change_memberid"]').val(_data.change_memberid)
      $('input[name="mobile"]').val(_data.mobile)

			layui.config({
				base: '../../../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'form', 'laytpl', 'laydate'], function() {
				var $ = layui.$,
					admin = layui.admin,
					laytpl = layui.laytpl,
					laydate = layui.laydate,
					form = layui.form;

				//监听提交
				form.on('submit(demo1)', function(data) {
					var data = data.field;
          console.log(data);

					layer.confirm('确定提交数据？', function() {
						loading();
						submitdata(data);
					}, function() {
						layer.msg('取消操作');
					});
					return false;
				});

				function submitdata(data) {
					$.post(server.sys_member_change_identity, data, function(res, status) {
						if(status == 'success') {
							if(res.code == 0) {
								layer.alert('操作成功', function() {
									parent.layer.closeAll();
									parent.layui.table.reload('test-table-operate');
								});
								layer.closeAll('loading');
							} else {
								layer.msg(res.msg);
								layer.closeAll('loading');
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
			});
		</script>
	</body>

</html>